package com.mxpio.erp.common.equipment.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mxpio.erp.common.jpa.policy.ResCodeGeneratorPolicy;
import com.mxpioframework.jpa.annotation.Generator;
import com.mxpioframework.security.annotation.Dict;
import com.mxpioframework.security.entity.BaseEntity;
import com.mxpioframework.security.entity.Dept;
import com.mxpioframework.security.entity.User;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 设备台账对象 MB_ERP_EQUIPMENT_EQP_BASICS
 *
 * @author Cheng
 * @date 2023-07-01
 */
@Data
@EqualsAndHashCode(callSuper=false)
@Entity
@Table(name = "MB_ERP_EQUIPMENT_EQP_BASICS")
@Schema(description="设备(实例/资产)信息")
public class EquipmentEqpBasics extends BaseEntity {

private static final long serialVersionUID=1L;

    @Id
    @Column(name = "BASICS_CODE_")
    @Schema(description = "资产编号")
    @Generator(policy = ResCodeGeneratorPolicy.class)
    private String basicsCode;
    /*@Generator(policy = UUIDPolicy.class)
    @Column(name = "ID_")
    @Schema(description = "主键")
    private String id;*/

    @Column(name = "EQP_NAME_")
    @Schema(description = "设备名称")
    private String eqpName;

    @Column(name = "EQP_CODE_")
    @Schema(description = "设备编码")
    @Dict(dicCode="eqpCode", dicEntity = Equipment.class, dicText = "eqpName")
    private String eqpCode;

    @Column(name = "EQP_TYPE_ID_")
    @Schema(description = "设备分类ID")
    @Dict(dicCode="code", dicEntity = EquipmentCategory.class, dicText = "name")
    private String eqpTypeId;

    @Column(name = "EQP_TYPE_NAME_")
    @Schema(description = "设备分类")
    private String eqpTypeName;

    @Column(name = "EQP_CLASS_")//增加设备类型
    @Schema(description = "设备类型")
    @Dict(dicCode = "ERP_EQUIPMENT_EQP_CLASS")
    private String eqpClass;

    @Column(name = "SPEC_TYPE_")
    @Schema(description = "规格型号")
    private String specType;

    @Column(name = "SEQ_NUMBER_")
    @Schema(description = "设备序列号")
    private String seqNumber;

    @Column(name = "BRAND_")
    @Schema(description = "品牌")
    private String brand;

    @Column(name = "NFC_NUMBER_")
    @Schema(description = "NFC码")
    private String nfcNumber;

    @Column(name = "PRODUCT_DATE_")
    @Schema(description = "出厂日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date productDate;

    @Column(name = "PIC_")
    @Schema(description = "图片")
    private String pic;

    @Column(name = "CODE_ABC_")
    @Schema(description = "设备ABC码")//
    @Dict(dicCode="ERP_EQUIPMENT_EQP_CODE_ABC")
    private String codeAbc;

    @Column(name = "AREA_ID_")
    @Schema(description = "区域")
    @Dict(dicCode="id", dicEntity = EquipmentArea.class, dicText = "areaName")
    private String areaId;

    @Column(name = "AREA_NAME_")
    @Schema(description = "区域名称")
    private String areaName;

    @Column(name = "COUNTRY_")
    @Schema(description = "国家")
    @Dict(dicCode="ERP_EQUIPMENT_COUNTRY")
    private String country;

    @Column(name = "WEIGHT_")
    @Schema(description = "设备重量")
    private String weight;

    @Column(name = "WEIGHT_UNIT_")
    @Schema(description = "重量单位")
    @Dict(dicCode="ERP_EQUIPMENT_WEIGHT_UNIT")
    private String weightUnit;

    @Column(name = "PURCHASE_DATE_")
    @Schema(description = "购置时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date purchaseDate;

    @Column(name = "CHECK_DATE_")
    @Schema(description = "验收时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date checkDate;

    @Column(name = "INSTALL_DATE_")
    @Schema(description = "安装时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date installDate;

    @Column(name = "WARRANTY_EXPIRES_")
    @Schema(description = "质保到期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date warrantyExpires;

    @Column(name = "SCRAP_DATE_")
    @Schema(description = "报废时间")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date scrapDate;

    @Column(name = "PURCHASE_TYPE_")
    @Schema(description = "购买方式")
    @Dict(dicCode = "ERP_EQUIPMENT_BUY_TYPE")
    private String purchaseType;

    @Column(name = "CAPITAL_TYPE_")
    @Schema(description = "客資/自資")
    @Dict(dicCode = "ERP_EQUIPMENT_KZ_ZZ")
    private String capitalType;

    @Column(name = "IS_BONDED_")
    @Schema(description = "是否保税")
    @Dict(dicCode = "ERP_COMMON_YESNO")
    private Integer isBonded;

    @Column(name = "USER_TIME_")
    @Schema(description = "使用年限")
    private Integer userTime;

    @Column(name = "RMB_WORTH_")
    @Schema(description = "设备原值(RMB)")
    private BigDecimal rmbWorth;

    @Column(name = "DEPRECIATION_TYPE_")
    @Dict(dicCode = "ERP_EQUIPMENT_DEPRECIATION_TYPE")
    @Schema(description = "折旧方式")
    private String depreciationType;

    @Column(name = "STATUS_")
    @Schema(description = "设备状态")
    @Dict(dicCode = "ERP_EQUIPMENT_EQP_STATUS")
    private Integer status;

    @Column(name = "IS_KEY_")
    @Schema(description = "是否关键设备")
    @Dict(dicCode = "ERP_COMMON_YESNO")
    private Integer isKey;

    @Column(name = "IS_PRECISE_")
    @Schema(description = "是否精密设备")
    @Dict(dicCode = "ERP_COMMON_YESNO")
    private Integer isPrecise;

    @Column(name = "IS_PRODUCE_")
    @Schema(description = "是否生产设备")
    @Dict(dicCode = "ERP_COMMON_YESNO")
    private Integer isProduce;

    @Column(name = "IS_DIGITAL_")
    @Schema(description = "是否数控设备")
    @Dict(dicCode = "ERP_COMMON_YESNO")
    private Integer isDigital;

    @Column(name = "IS_SUB_ORDINATE_")
    @Schema(description = "是否附属设备")
    @Dict(dicCode = "ERP_COMMON_YESNO")
    private Integer isSubOrdinate;

    /*@Column(name = "VENDOR_ID_")
    @Schema(description = "供应商")
    @Dict(dicCode="id", dicEntity = EquipmentMerchants.class, dicText = "name")
    private String vendorId;*/

    @Schema(description = "供应商编号")
    @Column(name = "PN_CODE_")
    private String pnCode;

    @Schema(description = "供应商名称")
    @Column(name = "PN_NAME_")
    private String pnName;

    @Column(name = "BIZ_MAN_")
    @Schema(description = "业务员")
    @Dict(dicCode = "username",dicEntity = User.class,dicText = "nickname")
    private String bizMan ;

    @Column(name = "PN_CONTACTS_")
    @Schema(description = "供应商联系人")
    private String pnContacts;

    @Column(name = "PN_PHONE_")
    @Schema(description = "供应商手机")
    private String pnPhone;

    @Column(name = "PN_TEL_")
    @Schema(description = "供应商电话")
    private String pnTel;

    @Column(name = "ATTR_DEPT_ID_")
    @Schema(description = "归属单位")
    @Dict(dicCode = "deptCode", dicEntity = Dept.class, dicText = "deptName")
    private String attrDeptId;

    @Column(name = "USE_DEPT_ID_")
    @Schema(description = "使用单位")
    @Dict(dicCode = "deptCode", dicEntity = Dept.class, dicText = "deptName")
    private String useDeptId;

    @Column(name = "DUTY_DEPT_ID_")
    @Schema(description = "责任单位")
    @Dict(dicCode = "deptCode", dicEntity = Dept.class, dicText = "deptName")
    private String dutyDeptId;

    @Column(name = "DUTY_USER_ID_")
    @Schema(description = "责任人")
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String dutyUserId;

    @Column(name = "LAY_ADDR_")
    @Schema(description = "安装地点")
    private String layAddr;

    @Column(name = "IS_DENGEROUS_")
    @Schema(description = "是否高危设备")
    @Dict(dicCode = "ERP_COMMON_YESNO")
    private Integer isDengerous;

    @Column(name = "IS_SPECIAL_")
    @Schema(description = "是否特种设备")
    @Dict(dicCode = "ERP_COMMON_YESNO")
    private Integer isSpecial;

    @Column(name = "REMARKS_")
    @Schema(description = "备注")
    private String remarks;

    @Column(name = "IS_DEL_")
    @Schema(description = "删除标记（0-正常；1-删除）")
    private Integer isDel;

    @Column(name = "USE_STATUS_")
    @Schema(description = "设备使用状态")
    @Dict(dicCode = "ERP_EQUIPMENT_EQP_USE_STATUS")//维修中、检定中
    private Integer useStatus;

    @Column(name = "POWER_")
    @Schema(description = "设备功率")
    private String power;

    @Column(name = "MANUFACTURER_")
    @Schema(description = "制造商")
    @Dict(dicCode="pnCode", dicEntity = EquipmentManufacturer.class, dicText = "pnName")
    private String manufacturer;

    @Column(name = "IS_ESA_")
    @Schema(description = "是否ESA设备")
    @Dict(dicCode = "ERP_COMMON_YESNO")
    private Integer isEsa;

    @Column(name = "IS_CALIBRATE_")
    @Schema(description = "是否需要检定")
    @Dict(dicCode = "ERP_COMMON_YESNO")
    private Integer isCalibrate;

    @Column(name = "CALIBRATE_CYCLE_")
    @Schema(description = "检定周期(天)")
    private Integer calibrateCycle;

    @Column(name = "LAST_CALIBRATE_DATE_")
    @Schema(description = "上次检定日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date lastCalibrateDate;//上次检定日期

    @Column(name = "IMG_FILE_")
    @Schema(description = "图片路径")
    private String imgFile;

    @Column(name = "REPAIR_GROUP_CODE_")
    @Schema(description = "维修群组")
    @Dict(dicCode="groupCode", dicEntity = EquipmentPersonGroup.class, dicText = "groupName")
    private String repairPersonGroupCode;

    @Column(name = "UPKEEP_GROUP_CODE_")
    @Schema(description = "保养群组")
    @Dict(dicCode="groupCode", dicEntity = EquipmentPersonGroup.class, dicText = "groupName")
    private String upkeepPersonGroupCode;

    @Column(name = "ENGINEER_GROUP_CODE_")
    @Schema(description = "工程师组")
    @Dict(dicCode="groupCode", dicEntity = EquipmentPersonGroup.class, dicText = "groupName")
    private String engineerPersonGroupCode;

    @Column(name = "CHECK_GROUP_CODE_")
    @Schema(description = "点检群组")
    @Dict(dicCode="groupCode", dicEntity = EquipmentPersonGroup.class, dicText = "groupName")
    private String checkPersonGroupCode;

    @Column(name = "INSPECT_DUTY_USER_")
    @Schema(description = "送检负责人")
    @Dict(dicCode = "username", dicEntity = User.class, dicText = "nickname")
    private String inspectDutyUser;

    @Column(name = "CALIBRATE_ADVANCE_")
    @Schema(description = "检定提前期(天)")//检定任务提前生成天数
    private Integer calibrateAdvance;

    @Column(name = "DIGITAL_CONTROL_")
    @Schema(description = "数控系统")
    @Dict(dicCode = "ERP_TECH_DIGITAL_CONTROL")//
    private String digitalControl;

    @Column(name = "LAST_UPKEEP_DATE_")
    @Schema(description = "上次保养日期")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date lastUpkeepDate;//上次保养日期

    @Column(name = "IS_RENEWAL_")
    @Schema(description = "是否批量更新")
    @Dict(dicCode = "MB_SYSTEM_YES_NO")// 0否，1是
    private String isRenewal;
}
